package com.neuresys.database.databaseimpl.jssqlite;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.TextResource;
import com.google.gwt.typedarrays.client.Uint8ArrayNative;
import com.neuresys.database.client.utils.JavaScriptInjector;
import com.neuresys.database.databaseapi.Connection;
import com.neuresys.database.databaseapi.ConnectionFactory;
import com.neuresys.database.databaseapi.Database;

public final class SQLiteFactory implements ConnectionFactory{

	private static SqliteJavaScript sqliteRessource;


	static
	{
		sqliteRessource = GWT.create(SqliteJavaScript.class);
		JavaScriptInjector.inject(sqliteRessource.sqliteJavascript().getText());
	}
	protected SQLiteFactory()
	{
		
	}
	public interface SqliteJavaScript extends ClientBundle
	{@Source("sql.js")
	TextResource sqliteJavascript();
	}
	@Override
	public native  SQLite createSQLite(Uint8ArrayNative s)
	/*-{
		 
		return $wnd.SQL.open(s);
	}-*/;
	

	@Override
	public native  SQLite createSQLite()
	/*-{
	
		return $wnd.SQL.open();
	}-*/;
}
